<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">ADABOOST</b>
<td valign="baseline" align="right" class="function"><a href="../misc/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>AdaBoost algorithm.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;=&nbsp;adaboost(data,options)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;This&nbsp;function&nbsp;implements&nbsp;the&nbsp;AdaBoost&nbsp;algorithm&nbsp;which</span><br>
<span class=help>&nbsp;&nbsp;produces&nbsp;a&nbsp;classifier&nbsp;composed&nbsp;from&nbsp;a&nbsp;set&nbsp;of&nbsp;weak&nbsp;rules.</span><br>
<span class=help>&nbsp;&nbsp;The&nbsp;weak&nbsp;rules&nbsp;are&nbsp;learned&nbsp;by&nbsp;a&nbsp;weak&nbsp;learner&nbsp;which&nbsp;is</span><br>
<span class=help>&nbsp;&nbsp;specified&nbsp;in&nbsp;options.learner.&nbsp;The&nbsp;task&nbsp;of&nbsp;the&nbsp;weak&nbsp;learner</span><br>
<span class=help>&nbsp;&nbsp;is&nbsp;to&nbsp;produce&nbsp;a&nbsp;rule&nbsp;with&nbsp;weighted&nbsp;error&nbsp;less&nbsp;then&nbsp;0.5.</span><br>
<span class=help>&nbsp;&nbsp;The&nbsp;Adaboost&nbsp;algorithm&nbsp;calls&nbsp;in&nbsp;each&nbsp;stage&nbsp;the&nbsp;weak&nbsp;learner</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rule{t}&nbsp;=&nbsp;feval(options.learner,weight_data)</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;where&nbsp;the&nbsp;structure&nbsp;weight_data&nbsp;contains</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;.X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Training&nbsp;vectors.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;.y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Labels&nbsp;of&nbsp;training&nbsp;vectos&nbsp;(1&nbsp;or&nbsp;2).</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;.D&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Distribution&nbsp;(weights)&nbsp;over&nbsp;training&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;which&nbsp;defines&nbsp;the&nbsp;weighted&nbsp;error.</span><br>
<span class=help>&nbsp;&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;The&nbsp;item&nbsp;rule{t}.fun&nbsp;must&nbsp;contain&nbsp;name&nbsp;of&nbsp;function</span><br>
<span class=help>&nbsp;&nbsp;which&nbsp;classifies&nbsp;vector&nbsp;X&nbsp;by&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;y&nbsp;=&nbsp;feval(&nbsp;rule{t}.fun,&nbsp;X,&nbsp;rule{t}).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;It&nbsp;is&nbsp;assumed&nbsp;that&nbsp;the&nbsp;weak&nbsp;rule&nbsp;responds&nbsp;with&nbsp;labels&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;1&nbsp;or&nbsp;2&nbsp;(not&nbsp;1,-1&nbsp;as&nbsp;used&nbsp;in&nbsp;AdaBoost&nbsp;literature).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;data&nbsp;[struct]&nbsp;Input&nbsp;training&nbsp;data:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Training&nbsp;vectors.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Labels&nbsp;of&nbsp;training&nbsp;vectos&nbsp;(1&nbsp;or&nbsp;2).</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;options&nbsp;[struct]&nbsp;Parameters&nbsp;of&nbsp;the&nbsp;AdaBoost:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.learner&nbsp;[string]&nbsp;Name&nbsp;of&nbsp;the&nbsp;weak&nbsp;learner.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.max_rules&nbsp;[1x1]&nbsp;Maximal&nbsp;number&nbsp;of&nbsp;weak&nbsp;rules&nbsp;(defaul&nbsp;100).</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;paramater&nbsp;defines&nbsp;a&nbsp;stopping&nbsp;condition.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.err_bound&nbsp;[1x1]&nbsp;AdaBoost&nbsp;stops&nbsp;if&nbsp;the&nbsp;upper&nbsp;bound&nbsp;on&nbsp;the&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;empirical&nbsp;error&nbsp;drops&nbsp;below&nbsp;the&nbsp;err_bound&nbsp;(default&nbsp;0.001).</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.learner_options&nbsp;Additinal&nbsp;options&nbsp;used&nbsp;when&nbsp;the&nbsp;weak&nbsp;learner</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;called.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.verb&nbsp;[1x1]&nbsp;If&nbsp;1&nbsp;then&nbsp;some&nbsp;info&nbsp;is&nbsp;displayed.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;[struct]&nbsp;AdaBoost&nbsp;classifier:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.rule&nbsp;[cell&nbsp;1&nbsp;x&nbsp;T]&nbsp;Weak&nbsp;classification&nbsp;rules.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Alpha&nbsp;[1&nbsp;x&nbsp;T]&nbsp;Weights&nbsp;of&nbsp;the&nbsp;rules.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.WeightedErr&nbsp;[1&nbsp;x&nbsp;T]&nbsp;Weighted&nbsp;errors&nbsp;of&nbsp;the&nbsp;weak&nbsp;rules.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Z&nbsp;[1&nbsp;x&nbsp;T]&nbsp;Normalization&nbsp;constants&nbsp;of&nbsp;the&nbsp;distribution&nbsp;D.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.ErrBound&nbsp;[1&nbsp;x&nbsp;T]&nbsp;Upper&nbsp;bounds&nbsp;on&nbsp;the&nbsp;empirical&nbsp;error.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;data&nbsp;=&nbsp;load('riply_trn');</span><br>
<span class=help>&nbsp;&nbsp;options.learner&nbsp;=&nbsp;'weaklearner';</span><br>
<span class=help>&nbsp;&nbsp;options.max_rules&nbsp;=&nbsp;100;</span><br>
<span class=help>&nbsp;&nbsp;options.verb&nbsp;=&nbsp;1;</span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;=&nbsp;adaboost(data,options);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;ppatterns(data);&nbsp;pboundary(model);</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;hold&nbsp;on;&nbsp;plot(model.ErrBound,'r');&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;plot(model.WeightedErr);</span><br>
<span class=help></span><br>
<span class=help>&nbsp;See&nbsp;also:&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;ADACLASS,&nbsp;WEAKLEARNER.</span><br>
<span class=help></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../misc/list/adaboost.html">adaboost.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2004, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 11-aug-2004, VF<br>

</body>
</html>
